//9.求6位老师结构体中教龄最短的教师及平均年龄
int main() {
    struct Teacher {
        char name[50];
        int age;
        int years_of_service; // 教龄
    };

    struct Teacher teachers[6];
    int i, min_index = 0;
    float total_years = 0;

    // 输入教师信息
    for (i = 0; i < 6; i++) {
        printf("请输入第%d位教师的姓名：", i + 1);
        scanf("%s", teachers[i].name);
        printf("请输入第%d位教师的年龄：", i + 1);
        scanf("%d", &teachers[i].age);
        printf("请输入第%d位教师的教龄：", i + 1);
        scanf("%d", &teachers[i].years_of_service);
        total_years += teachers[i].years_of_service;
    }

    // 找到教龄最短的教师
    for (i = 1; i < 6; i++) {
        if (teachers[i].years_of_service < teachers[min_index].years_of_service) {
            min_index = i;
        }
    }

    // 输出教龄最短的教师信息
    printf("教龄最短的教师是：%s，年龄：%d，教龄：%d年\n",
           teachers[min_index].name, teachers[min_index].age, teachers[min_index].years_of_service);

    // 计算并输出平均教龄
    float average_years = total_years / 6;
    printf("所有教师的平均教龄为：%.2f年\n", average_years);

    return 0;
}
